/*
 * TcpSocket.cpp
 *
 *  Created on: Nov 9, 2012
 *      Author: root
 */

#include "TcpSocket.h"
#include "SocketService.h"

namespace zeus
{

TcpSocket::TcpSocket(IoService & io_service)
:_service(io_service),_fd(0)
{
	bzero(&_peer,sizeof(_peer));
}

TcpSocket::~TcpSocket()
{
}

int32 TcpSocket::get_fd()const
{
	return _fd;
}

void TcpSocket::set_fd(int32 fd)
{
	_fd = fd;
}

void TcpSocket::set_peer(const sockaddr_in & peer)
{
	_peer = peer;
}

void TcpSocket::enable_writing()
{

}

void TcpSocket::enable_reading()
{

}

void TcpSocket::read_solid(Buffer & buff,size_t size,const IoHandler & complete_handler)
{
	_service.start_read_op(_fd,buff,complete_handler);
}

void TcpSocket::write_solid(Buffer & buff,size_t size,const IoHandler & complete_handler)
{
	_service.start_write_op(_fd,buff,complete_handler);
}

void TcpSocket::close()
{

}

} /* namespace zeus */
